package com.elvin.zoe.pojo.structure;

import com.elvin.zoe.pojo.CallMessage;
import com.elvin.zoe.pojo.ImMessage;
import com.elvin.zoe.pojo.Message;
import com.elvin.zoe.pojo.SmsMessage;


public class MessageCount{
    private int smsMessageCount = 0;
    private int callMessageDuration = 0;
    private int msnMessageCount = 0;

    public void addCount(MessageCount messageCount){
        if(messageCount == null) return;
        this.smsMessageCount += messageCount.smsMessageCount;
        this.callMessageDuration += messageCount.callMessageDuration;
        this.msnMessageCount += messageCount.msnMessageCount;
    }

    public void addCount(Message message){
        if(message == null)
            return;
        if(message instanceof SmsMessage)
            smsMessageCount ++;
        else if(message instanceof ImMessage)
            msnMessageCount ++;
        else if(message instanceof CallMessage)
            callMessageDuration += ((CallMessage)message).getDurationInSeconds();
    }

    public int getSmsMessageCount() {
        return smsMessageCount;
    }

    public void setSmsMessageCount(int smsMessageCount) {
        this.smsMessageCount = smsMessageCount;
    }

    public int getCallMessageDuration() {
        return callMessageDuration;
    }

    public void setCallMessageDuration(int callMessageDuration) {
        this.callMessageDuration = callMessageDuration;
    }

    public int getMsnMessageCount() {
        return msnMessageCount;
    }

    public void setMsnMessageCount(int msnMessageCount) {
        this.msnMessageCount = msnMessageCount;
    }
}